Help: Object text automatically changing

I have a module where every time I open it for editing, the text in the Object Text attribute automatically changes.  I have removed all the attribute and layout DXL code I can find, yet the Object Text is still changing.  The Object Text also changes when I switch from Read Only to Exclusive Edit, but does not change when I refresh the display or refresh the DXL attributes.

Any ideas what could be causing this?

 

Thanks,
Rick


RJOndrejicka - Mon May 13 13:04:09 EDT 2013

Re: Help: Object text automatically changing
llandale - Mon May 13 15:33:11 EDT 2013

Well a Trigger could do it.  You could reasonably prove that by logging in as a "Database Admin" or the "Administrator", run this DXL:

  • setTriggerState_(false)

Then open the module Edit and see if it is changing.

Finding the offending Trigger is another matter.

-Louie

Re: Help: Object text automatically changing
RJOndrejicka - Tue May 14 10:52:39 EDT 2013

llandale - Mon May 13 15:33:11 EDT 2013

Well a Trigger could do it.  You could reasonably prove that by logging in as a "Database Admin" or the "Administrator", run this DXL:

  • setTriggerState_(false)

Then open the module Edit and see if it is changing.

Finding the offending Trigger is another matter.

-Louie

Thanks Louie, that was exactly it!

Here's the trigger I found:

Trigger t = current Trigger
Module m = module t
if(canModify m) {
  Object o
  for o in entire m do {
    if(o."OtherAttr" "" != "") {
      set(o."Object Text", o."
OtherAttr")
    }
  }
}

I used this code to find it:

Trigger t
Module m = current Module
Project p = current Project

if (null p) {
    print "No project open\n"
}
else {
    print "Current project is " name(p) ".\n"
}

if (null m) {
    print "No module open\n"
}
else {
    print "Current module is " name(m) ".\n"
}

for t in m do {
    print "==================\n"
    print "\tName: " name(t) "\n"
    print "\tLevel: " stringOf(level(t)) "\n"
    print "\tType: " stringOf(type(t)) "\n"
    print "\tEvent: " stringOf(event(t)) "\n"
    print "\tAttr: " attribute(t) "\n"
    print "\tKind: " kind(t) "\n"
    print "\tObject: " object(t) "\n"
    print "\tModule: " module(t) "\n"
    print "\tStored: " stored(t) "\n"
    print "\tScope: " scope(t) "\n"
    print "\tValue: " value(t) "\n"
    print "--------------------\n"
    print dxl(t)
    print "\n"
}

 

Re: Help: Object text automatically changing
llandale - Tue May 14 14:37:38 EDT 2013

RJOndrejicka - Tue May 14 10:52:39 EDT 2013

Thanks Louie, that was exactly it!

Here's the trigger I found:

Trigger t = current Trigger
Module m = module t
if(canModify m) {
  Object o
  for o in entire m do {
    if(o."OtherAttr" "" != "") {
      set(o."Object Text", o."
OtherAttr")
    }
  }
}

I used this code to find it:

Trigger t
Module m = current Module
Project p = current Project

if (null p) {
    print "No project open\n"
}
else {
    print "Current project is " name(p) ".\n"
}

if (null m) {
    print "No module open\n"
}
else {
    print "Current module is " name(m) ".\n"
}

for t in m do {
    print "==================\n"
    print "\tName: " name(t) "\n"
    print "\tLevel: " stringOf(level(t)) "\n"
    print "\tType: " stringOf(type(t)) "\n"
    print "\tEvent: " stringOf(event(t)) "\n"
    print "\tAttr: " attribute(t) "\n"
    print "\tKind: " kind(t) "\n"
    print "\tObject: " object(t) "\n"
    print "\tModule: " module(t) "\n"
    print "\tStored: " stored(t) "\n"
    print "\tScope: " scope(t) "\n"
    print "\tValue: " value(t) "\n"
    print "--------------------\n"
    print dxl(t)
    print "\n"
}

 

Makes me wonder who would deploy such a trigger.  No comments not tracking.  And I wonder the purpose.

You may want to add an "for t in p do" loop; getting triggers in the Project that would apply to the module.  Also a "for t in parent(p) do" loop, for all parent projects.  Also a "for t in database do" loop.  Yup, yuuuuck.  the "p" look regretably also reports triggers found in open modules, so you end up with these triggers twice.

-Louie

'value(t)' only applies to an active trigger, and gets the 'value' being used or proposed by attr-save triggers.  It won't return anything in your code since it is not a feature of the trigger definition.

I notice you correctly use "attribute(t)" for the definition; an active trigger would use "attrDef(t)" to get a handle on the attribute being modified.